{include file='public/meta' /}

<title>添加管理员 - 管理员管理 - H-ui.admin v3.0</title>
</head>
<body>

<article class="cl pd-20">

	<form action="" method="post" class="form form-horizontal" id="form-admin-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				
				{eq name="$user_info.username" value="admin"} <!--如果用户名是admin,不允许修改-->
				<input  type="text" class="input-text" disabled="disabled" value="{$user_info.username}" placeholder="" id="name" name="username">
				{else /}
				{eq name="$Think.session.user_info.username" value="$user_info.username" }
				<input  type="text" class="input-text" disabled="disabled" value="{$user_info.username}" placeholder="" id="name" name="username">
				{else /}
				<input  type="text" class="input-text" value="{$user_info.username}" placeholder="" id="name" name="username">
				{/eq}
				{/eq}

			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" autocomplete="off" value="{$user_info.password}"  placeholder="密码为6位" id="password" name="password">
			</div>
		</div>


		{eq name="$Think.session.user_info.username" value="admin"}
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">厂家：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box radius">
					<select class="select" name="oem" id="oem">
						<option value="">选择厂家：</option>
						{volist name="list" id="vo"}
							{if condition="$vo.name == $user_info.oem"}
								<option value="{$vo.name}" selected="selected">{$vo.name}</option>
							{else /}
								<option value="{$vo.name}">{$vo.name}</option>
							{/if}
						{/volist}
					</select>
				</span>
			</div>
		</div>
		{/eq}

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" placeholder="@" name="email" id="email" value="{$user_info.email}">
			</div>
		</div>


		{eq name="$Think.session.user_info.username" value="admin"}
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">角色：</label>
			<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
				<select class="select" name="role" size="1">
					<option value="1" >超级管理员</option>
					<option value="0" selected>管理员</option>
				</select>
				</span>
			</div>
		</div>
		{/eq}

		<!--将当前记录的id做为隐藏域发送到服务器-->
		<input type="hidden" value="{$user_info.id}" name="id">

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" id="submit" >
			</div>
		</div>
	</form>


</article>

{include file="public/footer" /}
<script>

	$(function(){

	 //    $("form").children().change(function(){
	 //        // $("#submit").removeClass('disabled');
	 //        $("#submit").removeAttr("disabled");
		// });
	    
        $("#submit").click(function(){
        	// alert("123!");
            $.ajax({
				type: "POST",
				url: "{:url('user/editUser')}",
				data: $("#form-admin-add").serialize(),
				dataType: "json",
				success: function(data){
					alert(data.message);
	                if (data.status == 1) {
	                    layer.close(layer.index);
	                    parent.location.reload(); // 父页面刷新
	                }
				}
			});

		});

	})
</script>


</body>
</html>